package com.whk.push;

public abstract class PushLogger {

    private PushLoggerLevel pushLoggerLevel;

    public void setPushLoggerLevel(PushLoggerLevel pushLoggerLevel) {
        this.pushLoggerLevel = pushLoggerLevel;
    }

    public void info(Object... objects){
        switch (pushLoggerLevel){
            case NONE:
            case ERROR:
                break;
            default:
                System.out.println(String.format("%n", objects));

        }
    }
    public void error(Throwable e, String str){
        switch (pushLoggerLevel){
            case NONE:
            case INFO:
                break;
            default:
                System.err.printf(str+"%n", e);
                break;

        }
    }

    public static class DefaultPushLogger extends PushLogger{
        private PushLoggerLevel pushLoggerLevel = PushLoggerLevel.NONE;
    }
    public static class AllPushLogger extends PushLogger{
        private PushLoggerLevel pushLoggerLevel = PushLoggerLevel.ALL;
    }

    public static enum PushLoggerLevel {
        NONE,
        ERROR,
        INFO,
        ALL;

        private PushLoggerLevel() {
        }
    }
}
